package org.toonWatch

class VoucherService {

    def springSecurityService
    static transactional = true
    
    int totalAmount = 0
    
    int getAmount(def userId){
        def user = User.findById(userId)
        if(user){
            if(user.voucher)
            user.voucher.each{
                this.totalAmount += it.amount
            }
        }
        totalAmount -= user.voucherUsed
        return totalAmount
    }

    def serviceMethod() {
        
    }
}
